package cn.flying.cloud.system.service;

import javax.annotation.Resource;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import cn.flying.cloud.base.common.vo.layui.XmSelect;
import cn.flying.cloud.system.role.entity.SysRoleInfo;
import cn.flying.cloud.system.role.service.SysRoleInfoService;

/**
 * <p>
 * 角色信息表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2024-04-02 13:07:31
 */
@Service
public class SysRoleService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private SysRoleInfoService sysRoleInfoService;

    /**
     * 角色下拉选
     *
     * @return
     */
    public List<XmSelect> getRoleSelectList() {
        List<SysRoleInfo> roleInfos = sysRoleInfoService.list();
        List<XmSelect> list = new ArrayList<>();
        XmSelect xmSelect;
        for (SysRoleInfo roleInfo : roleInfos) {
            xmSelect = new XmSelect();
            xmSelect.setName(roleInfo.getRoleName());
            xmSelect.setValue(roleInfo.getRoleId());
            xmSelect.setSelected(false);
            xmSelect.setDisabled(false);

            list.add(xmSelect);
        }
        return list;
    }
}
